package com.FH.context;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.core.Application;
import javax.ws.rs.ext.Provider;
import java.io.IOException;

@Provider
@ApplicationPath("/")
public class PlatFormActivator extends Application implements ContainerResponseFilter {

	@Override
	public void filter(final ContainerRequestContext requestContext,
					   final ContainerResponseContext cres) throws IOException {
		cres.getHeaders().add("Access-Control-Allow-Origin", "*");
		cres.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization,X-Requested-With");
		cres.getHeaders().add("Access-Control-Allow-Credentials", "true");
		cres.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
		cres.getHeaders().add("Access-Control-Max-Age", "1209600");


	}

	public PlatFormActivator()
	{
		//启动定时器
//		new TimerManager();
	}
//	public PlatFormActivator(Set<Class<?>> classes) {
//		classes.add(e)
//	}
//
//	Set<Class<?>> classes =new Set<Class<?>>();
//
//	@Override
//	public Set<Class<?>> getClasses() {
//
//		return classes;
//	}

}
